(0) Obligation:

JBC Problem based on JBC Program:
Manifest-Version: 1.0 Created-By: 1.6.0_16 (Sun Microsystems Inc.) Main-Class: GCD5
public class GCD5 {
public static int gcd(int a, int b) {
int tmp;
while(b > 0 && a > 0) {
tmp = b;
b = a % b;
a = tmp;
}
return a;
}

public static void main(String[] args) {
Random.args = args;
int x = Random.random();
int y = Random.random();
gcd(x, y);
}
}


public class Random {
static String[] args;
static int index = 0;

public static int random() {
String string = args[index];
index++;
return string.length();
}
}


(1) JBC2FIG (SOUND transformation)

Constructed FIGraph.

(2) Obligation:

FIGraph based on JBC Program:
GCD5.main([Ljava/lang/String;)V: Graph of 171 nodes with 1 SCC.


(3) FIGtoITRSProof (SOUND transformation)

Transformed FIGraph SCCs to IDPs. Logs:


Log for SCC 0:

Generated 16 rules for P and 8 rules for R.


Combined rules. Obtained 1 rules for P and 1 rules for R.


Filtered ground terms:


886_0_gcd_LE(x1, x2, x3, x4) → 886_0_gcd_LE(x2, x3, x4)
901_0_main_Return(x1) → 901_0_main_Return

Filtered duplicate args:


886_0_gcd_LE(x1, x2, x3) → 886_0_gcd_LE(x1, x3)

Combined rules. Obtained 1 rules for P and 1 rules for R.


Finished conversion. Obtained 1 rules for P and 1 rules for R. System has predefined symbols.


(4) Obligation:

IDP problem:
The following function symbols are pre-defined:
!=~Neq: (Integer, Integer) -> Boolean
*~Mul: (Integer, Integer) -> Integer
>=~Ge: (Integer, Integer) -> Boolean
-1~UnaryMinus: (Integer) -> Integer
|~Bwor: (Integer, Integer) -> Integer
/~Div: (Integer, Integer) -> Integer
=~Eq: (Integer, Integer) -> Boolean
~Bwxor: (Integer, Integer) -> Integer
||~Lor: (Boolean, Boolean) -> Boolean
!~Lnot: (Boolean) -> Boolean
<~Lt: (Integer, Integer) -> Boolean
-~Sub: (Integer, Integer) -> Integer
<=~Le: (Integer, Integer) -> Boolean
>~Gt: (Integer, Integer) -> Boolean
~~Bwnot: (Integer) -> Integer
%~Mod: (Integer, Integer) -> Integer
&~Bwand: (Integer, Integer) -> Integer
+~Add: (Integer, Integer) -> Integer
&&~Land: (Boolean, Boolean) -> Boolean


The following domains are used:

Boolean, Integer


The ITRS R consists of the following rules:
886_1_main_InvokeMethod(886_0_gcd_LE(x0, 0)) → 901_0_main_Return

The integer pair graph contains the following rules and edges:
(0): 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(x1[0] > 0 && x0[0] > 0, 886_0_gcd_LE(x0[0], x1[0]))
(1): COND_886_1_MAIN_INVOKEMETHOD(TRUE, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], x0[1] % x1[1]))

(0) -> (1), if ((x1[0] > 0 && x0[0] > 0* TRUE)∧(886_0_gcd_LE(x0[0], x1[0]) →* 886_0_gcd_LE(x0[1], x1[1])))


(1) -> (0), if ((886_0_gcd_LE(x1[1], x0[1] % x1[1]) →* 886_0_gcd_LE(x0[0], x1[0])))



The set Q consists of the following terms:
886_1_main_InvokeMethod(886_0_gcd_LE(x0, 0))

(5) IDPtoQDPProof (SOUND transformation)

Represented integers and predefined function symbols by Terms

(6) Obligation:

Q DP problem:
The TRS P consists of the following rules:

886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))

The TRS R consists of the following rules:

886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01))) → 901_0_main_Return
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
greater_int(pos(01), pos(01)) → false
greater_int(pos(01), neg(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(neg(01), neg(01)) → false
greater_int(pos(01), pos(s(y))) → false
greater_int(neg(01), pos(s(y))) → false
greater_int(pos(01), neg(s(y))) → true
greater_int(neg(01), neg(s(y))) → true
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
greater_int(pos(s(x)), neg(01)) → true
greater_int(neg(s(x)), neg(01)) → false
greater_int(pos(s(x)), neg(s(y))) → true
greater_int(neg(s(x)), pos(s(y))) → false
greater_int(pos(s(x)), pos(s(y))) → greater_int(pos(x), pos(y))
greater_int(neg(s(x)), neg(s(y))) → greater_int(neg(x), neg(y))
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
if(true, x, y) → x
if(false, x, y) → y
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)

The set Q consists of the following terms:

886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.

(7) UsableRulesProof (EQUIVALENT transformation)

As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [LPAR04] we can delete all non-usable rules [FROCOS05] from R.

(8) Obligation:

Q DP problem:
The TRS P consists of the following rules:

886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))

The TRS R consists of the following rules:

mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true

The set Q consists of the following terms:

886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))
and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.

(9) QReductionProof (EQUIVALENT transformation)

We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.[THIEMANN].

886_1_main_InvokeMethod(886_0_gcd_LE(x0, pos(01)))

(10) Obligation:

Q DP problem:
The TRS P consists of the following rules:

886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))
COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))

The TRS R consists of the following rules:

mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true

The set Q consists of the following terms:

and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.

(11) QDPOrderProof (EQUIVALENT transformation)

We use the reduction pair processor [LPAR04].


The following pairs can be oriented strictly and are deleted.


COND_886_1_MAIN_INVOKEMETHOD(true, 886_0_gcd_LE(x0[1], x1[1])) → 886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x1[1], mod_int(x0[1], x1[1])))
The remaining pairs can at least be oriented weakly.
Used ordering: Polynomial interpretation [POLO]:

POL(01) = 0   
POL(886_0_gcd_LE(x1, x2)) = x2   
POL(886_1_MAIN_INVOKEMETHOD(x1)) = x1   
POL(COND_886_1_MAIN_INVOKEMETHOD(x1, x2)) = x1   
POL(and(x1, x2)) = x1   
POL(false) = 0   
POL(greater_int(x1, x2)) = x1   
POL(greatereq_int(x1, x2)) = 0   
POL(if(x1, x2, x3)) = 0   
POL(minus_nat_s(x1, x2)) = x1   
POL(mod_int(x1, x2)) = 0   
POL(mod_nat(x1, x2)) = 0   
POL(neg(x1)) = 0   
POL(pos(x1)) = x1   
POL(s(x1)) = 1 + x1   
POL(true) = 1   

The following usable rules [FROCOS05] were oriented:

greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true
mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))

(12) Obligation:

Q DP problem:
The TRS P consists of the following rules:

886_1_MAIN_INVOKEMETHOD(886_0_gcd_LE(x0[0], x1[0])) → COND_886_1_MAIN_INVOKEMETHOD(and(greater_int(x1[0], pos(01)), greater_int(x0[0], pos(01))), 886_0_gcd_LE(x0[0], x1[0]))

The TRS R consists of the following rules:

mod_int(pos(x), pos(y)) → pos(mod_nat(x, y))
mod_int(pos(x), neg(y)) → pos(mod_nat(x, y))
mod_int(neg(x), pos(y)) → neg(mod_nat(x, y))
mod_int(neg(x), neg(y)) → neg(mod_nat(x, y))
mod_nat(01, s(x)) → 01
mod_nat(s(x), s(y)) → if(greatereq_int(pos(x), pos(y)), mod_nat(minus_nat_s(x, y), s(y)), s(x))
minus_nat_s(x, 01) → x
minus_nat_s(01, s(y)) → 01
minus_nat_s(s(x), s(y)) → minus_nat_s(x, y)
greater_int(pos(01), pos(01)) → false
greater_int(neg(01), pos(01)) → false
greater_int(pos(s(x)), pos(01)) → true
greater_int(neg(s(x)), pos(01)) → false
and(false, false) → false
and(false, true) → false
and(true, false) → false
and(true, true) → true

The set Q consists of the following terms:

and(false, false)
and(false, true)
and(true, false)
and(true, true)
greater_int(pos(01), pos(01))
greater_int(pos(01), neg(01))
greater_int(neg(01), pos(01))
greater_int(neg(01), neg(01))
greater_int(pos(01), pos(s(x0)))
greater_int(neg(01), pos(s(x0)))
greater_int(pos(01), neg(s(x0)))
greater_int(neg(01), neg(s(x0)))
greater_int(pos(s(x0)), pos(01))
greater_int(neg(s(x0)), pos(01))
greater_int(pos(s(x0)), neg(01))
greater_int(neg(s(x0)), neg(01))
greater_int(pos(s(x0)), neg(s(x1)))
greater_int(neg(s(x0)), pos(s(x1)))
greater_int(pos(s(x0)), pos(s(x1)))
greater_int(neg(s(x0)), neg(s(x1)))
mod_int(pos(x0), pos(x1))
mod_int(pos(x0), neg(x1))
mod_int(neg(x0), pos(x1))
mod_int(neg(x0), neg(x1))
mod_nat(01, s(x0))
mod_nat(s(x0), s(x1))
if(true, x0, x1)
if(false, x0, x1)
minus_nat_s(x0, 01)
minus_nat_s(01, s(x0))
minus_nat_s(s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.

(13) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LPAR04,FROCOS05,EDGSTAR] contains 0 SCCs with 1 less node.

(14) TRUE